package Homework0812;

import com.sun.xml.internal.ws.api.pipe.Fiber;

import java.util.*;

public class ListDemo {
    public static void main(String[] args) {
        List<Point> l1=new LinkedList<>();
        l1.add(new Point(1,2));
        l1.add(new Point(18,32));
        l1.add(new Point(3,3));
        l1.add(new Point(1,2));
        l1.add(new Point(5,2));
        System.out.println(l1);

        Point point = new Point(1,2);
        boolean b=l1.remove(point);
        System.out.println(b);
        System.out.println(l1);

        List<String> l2=new ArrayList<>();
        l2.add("aa");
        l2.add("bb");
        l2.add("cc");
        l2.add("3333");
        l2.add("aa");
        System.out.println(l2);

        String s = "aa";
        boolean b1=l2.remove(s);
        System.out.println(b1);
        System.out.println(l2);

        l2.add(2,"222");
        System.out.println(l2);

        Iterator<String> it = l2.iterator();
        while(it.hasNext())
        {
            String string = it.next();
            if(string.equals("222"))
                it.remove();
            System.out.println(string);
        }
        System.out.println(l2);
    }
}
